package collection;

import java.util.ArrayList;
import java.util.List;

public class SubListDemo {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList();
        for (int i = 0; i < 10; i++) {
            list.add(i * 10);
        }
        System.out.println(list);

//        ArrayList<Integer> list1 = (ArrayList)list.subList(4,9);
        List<Integer> list1 = list.subList(4, 9);
        System.out.println(list1);

        for (int i = 0; i < list1.size(); i++) {
            list1.set(i, list1.get(i) * 10);
        }
        System.out.println(list1);
        System.out.println(list);

//        list.remove(0);  //--------------异常
        System.out.println(list1);
        System.out.println(list);
    }
}
